package com.bobochang.warehouse.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bobochang.warehouse.entity.ConstructionType;
import com.bobochang.warehouse.page.Page;
import com.bobochang.warehouse.service.ConstructionTypeService;
import com.bobochang.warehouse.mapper.ConstructionTypeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author bobochang
* @description 针对表【construction_type(施工类型表)】的数据库操作Service实现
* @createDate 2024-06-25 10:22:26
*/
@Service
public class ConstructionTypeServiceImpl extends ServiceImpl<ConstructionTypeMapper, ConstructionType>
    implements ConstructionTypeService{

    @Autowired
    private ConstructionTypeMapper constructionTypeMapper;

    public List<ConstructionType> listByContractId(Integer contractId) {
        return baseMapper.selectListByContractId(contractId);
    }

    @Override
    public Page queryLocationPage(Page page, ConstructionType constructionType) {
        // 查询施工类型总行数
        int locationCount = constructionTypeMapper.selectLocationCount(constructionType);
        // 分页查询施工位置
        List<ConstructionType> locationList = constructionTypeMapper.selectLocationPage(page, constructionType);
        // 结果封装到Page对象
        page.setTotalNum(locationCount);
        page.setResultList(locationList);
        return page;
    }

    @Override
    public List<ConstructionType> findAllList() {
        return baseMapper.selectAllList();
    }

    @Override
    public List<ConstructionType> findAllListById(int id) {
        return baseMapper.selectAllListById(id);
    }
}




